package com.example.nbshopping.fpage;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.viewpager.widget.PagerAdapter;
import java.util.List;

public class BannerAdapter extends PagerAdapter {
    List<ImageView>viewlist;
    public BannerAdapter(List<ImageView> viewlist) {
        this.viewlist = viewlist;
    }
    @Override
    public int getCount() {
        return viewlist.size();
    }
    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }
    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        ImageView view = viewlist.get(position);
        container.addView(view);
        return view;
    }
    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        ImageView view = viewlist.get(position);
        container.removeView(view);
    }
}
